package com.dab.springboot.generator.common;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

//包装类
@Data
@AllArgsConstructor                                                                                                                  //gzhs
@NoArgsConstructor
public class R {
    //判断是否
    private String code;
    //错误原因
    private String msg;
    //数据
    private Object data;

    public static R success() {
        return new R(Constants.C0DE_200, "", null);
    }

    public static R success(Object data) {
        return new R(Constants.C0DE_200, "", data);
    }

    public static R error(String code, String msg) {
        return new R(code, msg, null);
    }

    public static R error() {
        return new R(Constants.C0DE_500, "系统错误", null);
    }
}
